perm filename TRANS.INT[AM,DBL] blob sn#617133 filedate 1981-10-13 generic text, type T, neo UTF8
~j(635)
~j
C1:		enter(if n is constant then der(n,x)=0);
C2:		enter(a is constant);			we could have said "C2: a is constant", then "C3: enter(C2);"
C3:		enter(b is constant);
C4:		enter(c is constant);
C5:		enter(d is constant);
C6:		enter(e is constant);
C7:		prob(der(c,x)=?);
C8:		prob(der(f,x)=?);				unknown, since f might involve x
C9:		prob(der(a,z)=?);				substitution of z for x in rule C1
C10:	prob(der(99,u)=?);				doesn't know that numbers are constant
C11:	enter(if number(n) then n is constant);
C12:	redo(C10);						and now it DOES know that
C13:	if n is constant and not n=0 then der(x↑n,x)=n*x↑(n-1);
C14:	enter(c13); 						if we had mistyped C13, above, we
C15:	prob(der(t↑9,t)=?);
C15b:	simp;							start automatic algebraic simplification
						we could have added a large collection of simp rules instead,
						e.g., enter(simp(u↑0)=1), enter(simp(ln(e))=1), enter(simp(u*0)=0), etc.
C15c:	redo(C15);						this shows one of the things simp does.
C16:	prob(der(t↑9+t↑2,t)=?);		The program doesn't know how to handle sums;
C17:	if der(f,x)=u and der(g,x)=v then der(f+g,x)=u+v;
C18:	enter(C17);
C19:	redo(C16);						and now it DOES know how;
C20:	prob(der(z↑8+z↑2+z↑5,z)=?);	plus is always parsed automatically into binary-plus
C21:	prob(der(x↑2+x↑-5+7,x)=?);	negative powers, and numbers, work as well.
C22:	prob(der(y↑5-y↑2,y)=?);		doesn't know how to handle subtraction yet~j\75i50I6i5I158i32I27i34I28i38I67i25I85i33I44i188I22i39I31i44I94i25I34i53I32i43I31i42I
C23:	if der(f,x)=u and der(g,x)=v then der(f+g,x)=u-v;
C24:	enter(C23);
C25:	redo(C22);
C26:	prob(der(z-z↑0,z)=?);			doesn't handle z or z↑0 yet
C27:	enter(der(x↑0,x)=0);				could have typed "enter(if n=0 then der(x↑n,x)=0);
C28:	enter(der(y,y)=1);
C29:	redo(C26);						now it does work
C30:	prob(der(z↑5-z+z↑2-9,z)=?);	multiple uses of plus and minus signs~j\117i28I29i18I6i26I46i11I1i4I34i37I
C31:	if n is constant and der(f,x)=u then der(n*f,x)=n*u;
C32:	enter(C31);
C33:	prob(der(7*x↑5 - 2*x,x)=?);
C34:	if n is constant and der(f,x)=u then der(f*n,x)=n*u;
C35:	enter(C34);
C36:	prob(der(7↑x,x)=?);
C37:	der(n↑x,x)=n↑x*ln(n);
C38:	enter(C37);
C39:	redo(C36);
C40:	prob(der(x↑x,x)=?);				Wrong!  We should have said n is constant in C37
C41:	forget(C37);
C42:	if n is constant then der(n↑x,x)=n↑x*ln(n);
C43:	enter(C42);
C44:	redo(C40);						That's better; now it fails, as it should!
C45:	prob(der(e↑y,y=?);				correct, but the following makes it faster:
C46:	enter(der(e↑x,x)=e↑x);
C47:	redo(C45);
C48:	enter(if n is constant and der(f,x)=u then der(f/n,x)=u/n);
C49:	prob(der(x/4,x)=?);
C50:	prob(der(4*z↑9 / 12  - 2*z↑-4 / 11, z)=?);
C51:	enter(der(sin(x),x)=cos(x));
C52:	enter(der(cos(x),x)= -sin(x));
C53:	enter(der(tan(x),x)=sec(x)↑2);
C54:	enter(der(cot(x),x)= -csc(x)↑2);
C55:	enter(der(sec(x),x)= sec(x)*tan(x));
C56:	enter(der(csc(x),x)= -csc(x)*cot(x));
C57:	enter(der(ln(x),x)=1/x);
C58:	enter(der(log(x),x)=log(10)/x);
C59:	enter(der(arcsin(x),x)=(1-x↑2)↑-.5);
C60:	enter(der(arccos(x),x)= -(1-x↑2)↑-.5);
C61:	enter(der(arctan(x),x)= 1/(1+x↑2));
C62:	enter(der(arccot(x),x)= -1/(1+x↑2));
C63:	enter(der(tanh(x),x)=sech(x)↑2);
C64:	enter(der(coth(x),x)= -csch(x)↑2);
C65:	enter(der(sech(x),x)= -sech(x)*tanh(x));
C66:	enter(der(csch(x),x)= -csch(x)*coth(x));
C67:	enter(der(sinh(x),x)= cosh(x));
C68:	enter(der(cosh(x),x)= sinh(x));
C69:	enter(der(arcsinh(x),x)= (1+x↑2)↑-.5);
C70:	enter(der(arccosh(x),x)= (x↑2 - 1)↑-.5);
C71:	enter(der(arctanh(x),x)= 1/(1-x↑2));
C73:	enter(der(arccsch(x),x)= -1/x * (1+x↑2)↑-.5);
C74:	enter(der(arcsech(x),x)= -1/x * (x↑2 - 1)↑-.5);
C75:	enter(der(arccsc(x),x)= -1/x * (x↑2 - 1)↑-.5);
C76:	enter(der(arcsec(x),x)= 1/x * (x↑2 - 1)↑-.5);
C79:	prob(der(a*csch(x) - 3*sin(x),x)=?);
C79b:	enter(sin is cir);			Let's categorize our functions: cir, cirh, trig, math
C79c:	enter(cos is cir);
C79d:	enter(tan is cir);
C79e:	enter(cot is cir);
C79f:	enter(sec is cir);
C79g:	enter(csc is cir);
C79h:	enter(arcsin is cir);
C79i:	enter(arccos is cir);
C79j:	enter(arctan is cir);
C79k:	enter(arccot is cir);
C79l:	enter(arcsec is cir);
C79m:	enter(arccsc is cir);
C79b:	enter(sinh is cirh);
C79c:	enter(cosh is cirh);
C79d:	enter(tanh is cirh);
C79e:	enter(coth is cirh);
C79f:	enter(sech is cirh);
C79g:	enter(csch is cirh);
C79h:	enter(arcsinh is cirh);
C79i:	enter(arccosh is cirh);
C79j:	enter(arctanh is cirh);
C79k:	enter(arccoth is cirh);
C79l:	enter(arcsech is cirh);
C79m:	enter(arccsch is cirh);
C79n:	enter(if f is cir then f is trig);
C79o:	enter(if f is cirh then f is trig);
C79p:	enter(if f is trig then f is math);
C79q: enter(if f is arith then f is math);
C79r:	enter(log is arith);
C80s:	enter(ln is arith);
C79t:	enter(+ is arith);
C80u:	enter(- is arith);
C79r:	enter(* is arith);
C80s:	enter(/ is arith);
C79t:	enter(↑ is arith);
C80u:	enter( is arith);
C80:	if der(f,x)=u and der(g,x)=v then der(f*g,x)=f*v+g*u;
C81:	enter(C80);
C82:	prob(der(sin(x)*ln(x),x)=?);
			unfortunately, C80 might apply even to der(4*x,x), which is very wasteful
			We therefore want to say that ANY method for handling products is better than C80.
			we could make a blanket statement like: if method(r)=C80 then better(s,r), or:
C83:  if meth(r,D31) and meth(s,D80) then better(r,,s);  
C84:	enter(D83);
C85:  if meth(r,D34) and meth(s,D80) then better(r,,s);  
C86:	enter(D85);
			Another thing we could have done was assign Specificity measures to all rules,
			and add a single, general new meta-rule: if specificity(r)>specificity(s) then better(r,s)
			In order to handle der(f/g,x), we could type in a specific rule, such as:
C87:	if der(f,x)=u and der(g,x)=v then der(f/g,x)=(g*u-f*v)/g↑2;   
			or we could have typed a general rule about f/g becoming f*(g↑-1) and thus
			letting C80 -- and also C83 and C85 -- do all the work. This way, we have to say:
C88:  if meth(r,D31) and meth(s,D87) then better(r,,s);  
C89:	enter(D83);
C90:  if meth(r,D34) and meth(s,D87) then better(r,,s);  
C91:	enter(D85);
C92:	enter(C87);				almost forgot to say that!
C93:	prob(der(5*ln(x)*sin(x)/csch(x),x)=?);
C94:	if der(f,z)=u and der(z,x)=v then der(f,x)=u*v;
C95:	enter(C94);				this is the fundamental theorem of differential calculus!
C96:	prob(der(sin(sin(x)),x)=?);
C97:	prob(der(cosh(x)↑30,x)=?);
C97:	prob(der(cosh(x↑30-ln(x)),x)=?);
C98:	prob(der(7*x↑3 - a*x,x)=?); 	why does this take so long?
										Trouble! Rule C94 applies all the time!
										Add a meta-rule: C94 is too general to be first-choice.
C99:	if meth(r,D94) then better(s,r);
C99b:	enter(D99);
C100:	redo(C98);
C100b:	if der(f(z),z)=u and der(z,x)=v then der(f(z),x)=u*v;
C100c:	enter(C94);				this is a special case of the fundamental theorem (D94)
C100d:	enter(if meth(r,D100b) and not meth(s,D94) then better(s,r));
C100e:	redo(C97b);

										now we are ready to do integration.
										90% of all we've typed in so far can be used at once:
C101:	if der(f,x)=g then int(g,x)=f;	This is the fundamental theorem of integral calculus!~j\295i49I106i42I28i43I1300i53I1119i242I150i175I1i77I71i159I171i26I118i58I135i145I157i55I69i1I20i110I37i53I
C102:	prob(int(sech(x)↑2,x)=?);		Can't work, since C101 isn't declared a rule yet:
C103:	enter(C101);
C104:	redo(C102);						Now it works!  Lots of problems can be done.
C105:	prob(int(sin(x),x)=?);
C106:	prob(int(x↑9,x)=?);				...but some exceed the abilities of the matcher. So we type:
C107:	if n is constant and not n=-1 then int(x↑n,x)=x↑(n+1) /(n+1);	
C108:	enter(C107);
C109:	redo(C106);
C110:	enter(if n is constant then int(n↑x,x)=n↑x/ln(n));
C111:	prob(int(a↑y,y)=?);
C112:	prob(int(f↑y,y)=?);				recall that "a" is constant but "f" is not
C113:	prob(int(ln(a)↑z,z)=?);			what went wrong?
C114;	verbose;
C115:	redo(C113);						aha! "ln(a) is constant"  failed to return TRUE!
C116:	terse;							we must add some more rules about what is constant:
C117:	if n is constant then ln(n) is constant;
C118:	enter(C117);
C119:	redo(C113);						that's more like it!  We could also add:
C---:	enter(if n is constant then sin(n) is constant);
C---:	enter(if n is constant then cos(n) is constant);
C---:	enter(if n is constant then tan(n) is constant);
C---:	enter(if n is constant then cot(n) is constant);
C---:	enter(if n is constant then sec(n) is constant);
C---:	enter(if n is constant then csc(n) is constant);
C---:	enter(if n is constant then sinh(n) is constant);
C---:	enter(if n is constant then cosh(n) is constant);
C---:	enter(if n is constant then tanh(n) is constant);
C---:	enter(if n is constant then coth(n) is constant);
C---:	enter(if n is constant then sech(n) is constant);
C---:	enter(if n is constant then csch(n) is constant);
C---:	enter(if n is constant and m is constant then n*m is constant);
C---:	enter(if n is constant and m is constant then n+m is constant);
C---:	enter(if n is constant and m is constant then n/m is constant);
C---:	enter(if n is constant and m is constant then n-m is constant);
C---:	enter(if n is constant and m is constant then n↑m is constant);
C---:	enter(if n is constant then -n is constant);
					alternatively, since we have grouped functions into categories,
					sin, cos, tan, sec, csc are "cir" functions
					sinh, cosh, etc. are "cirh" functions
					-, +, *, /. ↑, and unary minus are "arithmetic" functions
					cir and cirh functions are "trig" functions
					trig functions and arithmetic functions are "math" functions
					Then we just say that math functions applied to constants are constants:
C120:	forget(C117);
C121:	redo(C113):					Just to show it no longer works anymore.
C122:	if f is math and n is constant then f(n) is constant;
C122:	if f is math and n is constant and m is constant then f(m,n) is constant;
C121:	redo(C113):					Just to show it now works again.  So C122 and C122
									take the place of ALL the C-- rules above.
C137:	enter(int(1/x)=ln(x));
C138:	enter(int(x↑-1)=ln(x));		With a good matcher/simplifier, we wouldn't need both of these.
C139:	if n is constant and int(f,x)=u then int(n*f,x)=n*u;
C140:	enter(C139);
C141:	if n is constant and int(f,x)=u then int(f*n,x)=n*u;
C142:	enter(C141);
C143:	if int(f,x)=u and int(g,x)=v then int(f+g,x)=u+v;
C144:	enter(C143);
C145:	if int(f,x)=u and int(g,x)=v then int(f-g,x)=u-v;
C145:	enter(C145);
C146:	if n is constant and int(f,x)=u then int(f/n,x)=u/n;
C147:	enter(C146);
C148:	prob(int(9*x↑5 - 3*ln(b)↑x/cos(3*a))=?);		tests several of the above rules
C149:	prob(int(x*e↑x,x)=?);							can't yet be done
C150:	if int(h,x)=g and der(f,x)=j and int(j*g,x)=r then int(f*h,x)=f*g-r;
C151:	enter(C150);						This is Integration by Parts
C152:	redo(C149);						now it works
C153:	prob(int(8*x↑5 - 3*ln(a)↑x/cos(3*c))=?);		this is very much like C148,
										but could take a long time, since C150 applies now!
C154:	enter(if met(r,D150) then better(s,r));		ANY int rule is preferable to D150!
C155:	prob(int(11*x↑7 - 5*ln(d)↑x/cos(3*b))=?);	now it runs faster again!
			Now there are many additional integration rules worth adding:
C156:	enter(if n is constant then int((n↑2 - x↑2)↑-.5,x)=arcsin(x/n));
C157:	enter(if n is constant then int((x↑2+n↑2)↑-.5,x)=ln(abs(x+(x↑2+n↑2)↑.5)));
C158:	enter(if n is constant then int((x↑2-n↑2)↑-.5,x)=ln(abs(x+(x↑2 - n↑2)↑.5)));
C159:	enter(int(sec(x),x)=ln(abs(sec(x)+tan(x))));
C160:	enter(int(csc(x),x)=ln(abs(csc(x)-cot(x))));
C161:	enter(int(tanh(x),x)=ln(cosh(x)));
C162:	enter(int(tan(x),x)=-ln(abs(cos(x))));
C163:	enter(int(tan(x),x)=ln(abs(sec(x))));
C164:	enter(int(coth(x),x)=ln(abs(sinh(x))));
C165:	enter(int(sech(x),x)=arctanh(sinh(x)));
C166:	enter(int(cot(x),x)=ln(abs(sin(x))));
C167:	enter(int(csch(x),x)=-arccoth(cosh(x)));
C168:	enter(if n is constant then int((x↑2+n↑2)↑-1,x)=1/n * arctan(x/n));
C169:	enter(if n is constant then int((x↑2-n↑2)↑-1,x)=1/(2*n) * ln(abs((x-n)/(x+n))));
C170:	enter(if n is constant then int(1/(x*(n↑2+x↑2)↑.5),x)= 1/n * ln(abs(x/(n+(n↑2+x↑2)↑.5))));
C171:	enter(if n is constant then int(1/(x*(n↑2-x↑2)↑.5),x)= 1/n * ln(abs(x/(n+(n↑2-x↑2)↑.5))));
C172:	enter(if n is constant then int(1/(x*(x↑2-n↑2)↑.5),x)= 1/n * arccos(n/u));
C173:	enter(if n is constant then int((x↑2 - n↑2)↑.5 dx) = (x/2)*(x↑2-n↑2)↑.5 - (n↑2/2)*ln(abs(x+(x↑2-n↑2)↑.5)));
C174:	enter(if n is constant then int((x↑2 + n↑2)↑.5 dx) = (x/2)*(x↑2+n↑2)↑.5 + (n↑2/2)*ln(abs(x+(x↑2+n↑2)↑.5)));
C175:	enter(if n is constant then int((n↑2 - x↑2)↑.5 dx) = (x/2)*(n↑2-x↑2)↑.5 + (n↑2/2)arcsin(x/n)));
C176:	enter(if n is constant then int((n↑2 - x↑2)↑.5 dx) = (x/2)*(n↑2-x↑2)↑.5 + (n↑2/2)arcsin(x/n)));
C177: prob(int(x*sec(x)↑2,x)=?);
C178:	prob(int(x*(sin(a)↑2-x↑2)↑.5,x)=?);
C179:	prob(int(x*x*(sin(a)↑2-x↑2)↑.5,x)=?);
C180:	prob(int(a*x*x*x*(sin(ln(a))↑2-x↑2)↑.5,x)=?);
C181:	prob(int(sin(x)↑9*cos(x),x);	Until we enter substitution, problems like this can't be solved
C182:	if subpart(f,g) and der(g,x)=h and int(f,g)=u then int(f*h,x)=u;
C183:	enter(C182);				This is the general "substitution" rule of integration
C184:	redo(C181);					Subst works, but could be explosive! So:
C185:	if meth(r,D182) and not meth(s,D150) then better(s,r);
C185b:	enter(D185);					The only method worse than subst. is integration by parts!
C186:	prob(int((1+x)↑100*1,x)=?);	So subst works for this, but not on this one:
C187:	prob(int((1+x)↑100,x)=?);	
C188:	if subpart(f,g) and der(g,x)=h and h is constant and int(f,g)=u then int(f,x)=u/h;
C189:	enter(C188);				This chould now work on C187.
C190:	redo(C187);
C190b:	prob(int(sin(1/(a*x))*x↑-2,x)=?);
C191:	if subpart(f,g) and der(g,x)=h and int(f/h,g)=u then int(f,x)=u;
C192:	if meth(r,D188) and not meth(s,D150) and not meth(s,D191) then better(s,r);
C193:	if meth(r,D191) then better(s,r);	C191 is the MOST explosive form of substitution!
C194:	enter(D191);
C195:	enter(D192);
C196:	enter(D193);
C197:	redo(C190b);
C198:	prob(int(cos(x↑3)*e↑(sin(x↑3))*cos(x↑3),x)=?);
C199:	enter(if seen(t) then discard(t));		But "seen" isn't defined anywhere
C200:	enter(if in(t,x) and ancestor(t,s) and in(s,x) then seen(t));  But now what's "ancestor"
C201:	enter(if up(x,y) and ancestor(y,z) then ancestor(x,z));
C202:	enter(if up(x,y) then ancestor(x,y));
C203:	prob(int(sin(e↑x)*e↑-x,x)=?)		Infinite loops now caught by C199


Note that some operators can be used with spaces or with parentheses:
redo C22;     is the same as		redo(C22);
There are various "modes" that can be entered or quit:
verbose;   and     terse;       -- terse prints all intermediate subproblems
nosimp;   and     simp;				-- simp does automatic algebraic simplifications

There are also a few "commands" that do things:
save;		-- saves the Ci and Di lines on a file.  To begin next time, type reload;
reload;		-- see "save"
playback() -- types back all Ci and Di lines
playback(C) -- types back all Ci lines
playback(D) -- types back all Di lines
playback(37) -- types back all Ci and Di lines from present back to number C37
playback(C,37) -- types back all Ci lines from present back to number C37
playback(D,37) -- types back all Di lines from present back to number D37
~e12j\31i51I43i44I62i57I219i42I33i16I33i54I20i52I89i25u5U11I1066i416I44i41I162i103I60i63I433i33I27i24I100i29I19i17I48i91I45i37I48i27I3i62I1724i15u12U36I94i55I22i41I85i59I34i45I145i30I252i49I171i33I68i27I143i33I52i2I
~e12j